<?php
namespace app\controllers;
use Yii;
use yii\web\Controller;
use app\models\Goods;
use yii\data\Pagination;
/**
 * 
 */
class ShopController extends Controller
{

  public function actionaIndex(){

    return $this->render('index01');

  }

   public function actionShow(){

  // $page=$_GET['page'];
  //  print_r($page);
  
   $redis=new \Redis();
   $redis->pconnect('127.0.0.1','6379');
   $redis->select(12); 
   
   $query = Goods::find();
    $countQuery = clone $query;
   $pages = new Pagination(['totalCount' => $countQuery->count(),'defaultPageSize' => 3]);  
     
    $models = $query->offset($pages->offset)
        ->limit($pages->limit)
        ->all();
   
  //   if($redis->Exists("models")){
  //  $data=$redis->get("models");
  // $models=json_decode($data,true);
  //  }else{
  //   $redis->set("models",$models);
  //  }
   return $this->render('show', [
        'models' => $models,
        'pages' => $pages,
   ]);
  
   }
    






}







?>